/** Interactive Surface  FYP- 25 Interactive Surface FYP- 25 Interactive Surface FYP- 25
 *
 *  @author Acer
 */
package GestureRecognition;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import javax.swing.JFrame;
import javax.swing.JPanel;

/** Interactive Surface FYP- 25 Interactive Surface FYP- 25 Interactive Surface FYP- 25
 *  General Information about this class -
 *  Comments -
 */
public class TestSlide extends Thread implements MouseMotionListener {

    Slide tr;

    public static void main(String[] args) {
        TestSlide ty=new TestSlide();
        ty.start();

       
    }

    public int callGesture(int x, int y) {
        int[] fg = new int[2];
        fg[0] = x;
        fg[1] = y;
        return tr.identifyGestureType(fg);
    }
    JFrame jf = new JFrame();
    JPanel jpcan = new JPanel();
    int count = 0;
    int start = 1;

    @Override
    public void run() {
        tr = new Slide();
        vacate();
    }
    Graphics graph;

    public void vacate() {
        jf.setDefaultCloseOperation(2);

        //jpcan.setSize(1000, 00);
        jf.setSize(1100, 400);
        jf.add(jpcan);
        //jf.setExtendedState(JFrame.MAXIMIZED_BOTH);
        jf.setVisible(true);
        jpcan.setVisible(true);
        System.out.println("came here");
        int i = 0;
        graph = jpcan.getGraphics();
        jpcan.addMouseMotionListener(this);
    }

    public void mouseDragged(MouseEvent e) {
        // throw new UnsupportedOperationException("Not supported yet.");
    }
    int lastX, lastY;

    public void mouseMoved(MouseEvent e) {


        count++;
        if (start == 1) {
            start = 0;

        } else {
            graph.setColor(Color.black);
            graph.drawLine(lastX, lastY, e.getX(), e.getY());

        }
        lastX = e.getX();
        lastY = e.getY();

         callGesture(3*e.getX(),3*e.getY());

    }
}
